<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<script>
			var acount = parseInt(prompt("输入考试科目的数量"));
			var arr=[];
			var sum = 0;
			if(acount <= 0){
				alert("请输入正确的数字");
			}else{
				while(acount >= 1){
					var i = parseInt(prompt("请输入各科的成绩"));
					if(i<0){
						alert("请输入正确数字");
					}else{
						if(i >= 1){
							arr.push(i);
						}
						acount--;//当科目依次减的时候，依次弹出需要输成绩的框
						var length = arr.length;
						if(length >= 1){
							sum = arr[length-1]+sum;
							length--;
						}
					}
				}
				alert("科目总成绩:"+sum);
			}
			
		</script>
	</body>
</html>
